<@override name="content">
    <div class="header">
      <h1 class="page-title">用户角色</h1>
    </div>
    <ul class="breadcrumb">
      <li>
        <a href="admin">首页</a>
        <span class="divider">/</span>
      </li>
      <li>
        <a href="admin/user">用户管理</a>
        <span class="divider">/</span>
      </li>
      <li class="active">角色管理</li>
    </ul>
    <div class="container-fluid">
      <div class="row-fluid">
        <div class="well">
          <div id="container">
            <table id="role-list" class="table table-striped table-bordered" cellpadding="0" cellspacing="0" border="0" width="100%">
              <thead>
                <tr>
                  <th width="5%">Id</th>
                  <th width="30%">Name</th>
                  <th width="45%">Description</th>
                  <th width="5%">Status</th>
                  <th width="15%">Action</th>
                </tr>
              </thead>
              <tbody>
              </tbody>
            </table>
          </div>
        </div>
      </div>
    </div>
</@override>
    
    <@override name="scripts">
    <link href="assets/DataTables-1.9.4/media/css/jquery.dataTables.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="assets/DataTables-1.9.4/media/js/jquery.dataTables.js"></script>
    <script type="text/javascript" src="assets/js/dataTables.bootstrap.js"></script>
    <script type="text/javascript">
        var oTable = $('#role-list').jfinalDataTable({
          "sAjaxSource": "${baseUrl!}/api/admin/userRoleList",
          "aoColumns": [
                { "mData": "id" },
                { "mData": "name" },
                { "mData": "description",
                  "mRender": function (data, type, full) {
                     return '<a href="#">' + data + '</a>';
                  }
                },
                { "mData": "status",
                  "mRender": function (data, type, full) {
                    return '<a href="#">' + data + '</a>';
                  }
                },
                { "mData": null,
                  "bSortable": false,
                  "mRender": function (data, type, full) {
                    var action = '<button id="role-edit" uid="' + full.id 
                        + '" class="btn btn-success">Edit</button> '
                        + '<button id="role-toggle" uid="' + full.id 
                        + '" class="btn btn-warning">' 
                        + (full.status ? 'Delete' : 'Resume')
                        + '</button> ';
                    return action;
                  }
                }
            ],
        });
    </script>
 </@override>
<@extends name="../_layout.html"></@extends>
